package com.czxy.servlet;

import cn.itcast.servlet.BaseServlet;
import com.czxy.domain.User;

import javax.servlet.annotation.WebServlet;
import java.io.IOException;

@WebServlet("/helloServlet")
public class HelloServlet extends BaseServlet {

    public  void   show01() throws IOException {

        //给前端响应
        getResponse().getWriter().write("???");

    }

    public  void   show02() throws IOException {
        User user = toBean(User.class);
        System.out.println(user);

        getResponse().getWriter().write("收到了" );

    }

    public  void  checkUsername() throws IOException {
        User user = toBean(User.class);
        if ("jack".equals(user.getUsername())){
            //{"message":"用户名可用","flag":true}
            getResponse().getWriter().write("{\"message\":\"用户名可用\",\"flag\":true}");
        }else {
            getResponse().getWriter().write("{\"message\":\"用户名不可用\",\"flag\":false}");
        }
    }










}
